home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
251_01
/
advsys.doc
< prev
next >
Wrap
Text File
|
1987-10-27
|
31KB
|
1,189 lines
ADVSYS - An Adventure Writing System
Version 1.2
by David Betz
114 Davenport Avenue
Manchester, NH 03103
(603) 625-4691 (home)
July 14, 1986
Copyright (c) 1986, by David Betz
All Rights Reserved
Permission is hereby granted for unrestricted non-commercial use
ADVSYS An Adventure Writing System Page 2
INTRODUCTION
ADVSYS is a special purpose programming language that was
specifically designed to be used to write computer text
adventure games. It includes a facility for defining the kinds
of objects that are common in adventures. Some objects
represent locations on the game map, some objects represent
things that the player can find while exploring the adventure
world, and some objects represent other characters that the
adventurer can encounter during his or her journeys. The
adventure language also provides a facility to define actions.
Actions are short sections of code that determine what happens
in response to a command from the player. These two concepts,
"objects" and "actions" form the basis for the adventure
language.
ACKNOWLEDGEMENTS
Although I have written all of the code associated with this
adventure writing system, I must acknowledge the assistance of
one individual without whom this project would probably never
have reached completion. That person is Gary McGath. Gary was
interested in writing a commercial quality adventure game and I
convinced him to write it using my system (which was as yet
almost completely unspecified) instead of using a traditional
programming language. The input that Gary provided during the
development of his game contributed significantly to the overall
design of the system. I would like to thank Gary for that
contribution.
ADVSYS An Adventure Writing System Page 3
USING THE SYSTEM TO WRITE AN ADVENTURE
In order to write an adventure using this system, you need to
write an adventure description. This is an ordinary ASCII text
file containing definitions for all of the objects and actions
in your adventure game. This file is used as input to the
adventure compiler. The compiler takes the adventure
description and compiles it into a set of data structures.
In order to play an adventure written using this system, you
need the data structure file that was produced by the compiler
and the adventure interpreter program. The interpreter uses the
information produced by the adventure compiler to allow a player
to play the adventure game. Notice that it is not necessary for
the player to have access to the original adventure description
file. All of the information that is necessary to play the
adventure game is contained within the data structure file that
is produced by the compiler. This file is a binary file that
cannot be simply "listed" to reveal the internal workings of the
adventure.
The adventure compiler is called ADVCOM and the interpreter is
called ADVINT. These two programs in conjunction with this
documentation are all that is required to write and play
adventure games using this system.
ADVSYS An Adventure Writing System Page 4
RUNNING THE COMPILER
If you have created an adventure definition file called
"MYADV.ADV", you can compile it with the command:
A>advcom myadv
Typing this command will invoke the adventure compiler and cause
it to compile the file named "MYADV.ADV". The ".ADV" extension
is added to the file name by the compiler. During the process
of compiling the file, many messages will be printed telling
about the progress of the compiler. At the end of the
compilation process, the compiler prints a set of statistics
describing the resulting data structure file. This file will be
called "MYADV.DAT". It contains the data structures needed by
the adventure interpreter to allow a player to play the
adventure game.
Note: The "A>" in the line above is the MS-DOS prompt and should
not be typed as part of the command.
RUNNING THE INTERPRETER
Assuming that you have a compiled adventure data file called
"MYADV.DAT", you can play the adventure by typing the command:
A>advint myadv
This command will start the adventure. There will probably be
some text printed at this point describing the adventure and the
initial situation. You will then be prompted to type a command.
The prompt is the colon character. The format for commands is
described under the section about the parser. After typing a
command, you will be told what happened as a result of your
command, your new situation will be described and you will begin
the loop again.
ADVSYS An Adventure Writing System Page 5
ADVENTURE DESCRIPTION FILE FORMAT
All adventure description files contain a collection of
statements. These statements must be formed according to
the following rules:
The adventure definition statement:
All adventure definitions should have an ADVENTURE
statement. This statement gives the name of the adventure
and the version number of the definition file. Each
adventure should have a unique name. This name is used to
identify "saved position" files and insure that only files
that correspond to the current adventure are restored. The
version number allows the author to have many versions of
the same adventure during development and guarantee that
"save" files from one version aren't restored into another
version.
(ADVENTURE name version)
Example:
(ADVENTURE sample 1)
Vocabulary statements:
These statements add words to the adventure vocabulary.
(ADJECTIVE word*)
(PREPOSITION word*)
(CONJUNCTION word*)
(ARTICLE word*)
(SYNONYM word synonym*)
Examples:
(ADJECTIVE red blue)
(CONJUNCTION and)
(SYNONYM big large)
Note:
Words are also added to the vocabulary by the object
and action definitions using the NOUN, ADJECTIVE, VERB
and PREPOSITION statements.
ADVSYS An Adventure Writing System Page 6
Constant definition statement:
(DEFINE name value)
Examples:
(DEFINE what "I don't understand what you're saying!\n")
(DEFINE max-load 100)
Function definition statement:
(DEFINE (function-name [arg-name]* [&aux tmp-name*]) expr*)
Example:
(DEFINE (factorial n)
(IF (< n 2)
1